home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / Round_Cala215421642009.psc / new cal / Form1.frm < prev   
Text File  |  2009-06-02  |  19KB  |  602 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Save this"
  5.    ClientHeight    =   12555
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   17040
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   837
  11.    ScaleMode       =   3  'Pixel
  12.    ScaleWidth      =   1136
  13.    StartUpPosition =   2  'CenterScreen
  14.    WindowState     =   2  'Maximized
  15.    Begin VB.CheckBox Check6 
  16.       Caption         =   "Week No"
  17.       Height          =   255
  18.       Left            =   9120
  19.       TabIndex        =   32
  20.       Top             =   840
  21.       Value           =   1  'Checked
  22.       Width           =   1215
  23.    End
  24.    Begin MSComDlg.CommonDialog cd1 
  25.       Left            =   11760
  26.       Top             =   720
  27.       _ExtentX        =   847
  28.       _ExtentY        =   847
  29.       _Version        =   393216
  30.    End
  31.    Begin VB.CheckBox Check5 
  32.       Caption         =   "Cutting Line"
  33.       Height          =   255
  34.       Left            =   9120
  35.       TabIndex        =   31
  36.       Top             =   480
  37.       Value           =   1  'Checked
  38.       Width           =   1215
  39.    End
  40.    Begin VB.CheckBox Check4 
  41.       Caption         =   "Sun rise/set"
  42.       Height          =   255
  43.       Left            =   10320
  44.       TabIndex        =   30
  45.       Top             =   120
  46.       Width           =   1455
  47.    End
  48.    Begin VB.ComboBox Combo5 
  49.       Height          =   315
  50.       Left            =   240
  51.       TabIndex        =   29
  52.       Text            =   "Combo5"
  53.       Top             =   960
  54.       Width           =   855
  55.    End
  56.    Begin VB.ComboBox Text1 
  57.       Height          =   315
  58.       Left            =   2040
  59.       TabIndex        =   28
  60.       Text            =   "Combo5"
  61.       Top             =   120
  62.       Width           =   855
  63.    End
  64.    Begin VB.ComboBox Combo4 
  65.       Height          =   315
  66.       Left            =   3120
  67.       Sorted          =   -1  'True
  68.       TabIndex        =   27
  69.       Text            =   "Combo2"
  70.       Top             =   600
  71.       Width           =   2775
  72.    End
  73.    Begin VB.ComboBox Combo3 
  74.       Height          =   315
  75.       Left            =   6000
  76.       Sorted          =   -1  'True
  77.       TabIndex        =   26
  78.       Text            =   "Combo2"
  79.       Top             =   600
  80.       Width           =   2775
  81.    End
  82.    Begin VB.ComboBox Combo2 
  83.       Height          =   315
  84.       Left            =   240
  85.       Sorted          =   -1  'True
  86.       TabIndex        =   25
  87.       Text            =   "Combo2"
  88.       Top             =   600
  89.       Width           =   2775
  90.    End
  91.    Begin VB.CheckBox Check3 
  92.       Caption         =   "Include diary"
  93.       Height          =   255
  94.       Left            =   8880
  95.       TabIndex        =   24
  96.       Top             =   120
  97.       Value           =   1  'Checked
  98.       Width           =   1215
  99.    End
  100.    Begin VB.CheckBox Check2 
  101.       Caption         =   "Outer ring"
  102.       Height          =   255
  103.       Left            =   7440
  104.       TabIndex        =   23
  105.       Top             =   120
  106.       Width           =   1215
  107.    End
  108.    Begin VB.CheckBox Check1 
  109.       Caption         =   "Moon phases"
  110.       Height          =   255
  111.       Left            =   5760
  112.       TabIndex        =   22
  113.       Top             =   120
  114.       Value           =   1  'Checked
  115.       Width           =   1575
  116.    End
  117.    Begin Project1.IoxContainer Iox1 
  118.       Height          =   11055
  119.       Left            =   120
  120.       TabIndex        =   20
  121.       Top             =   1440
  122.       Width           =   16815
  123.       _ExtentX        =   29660
  124.       _ExtentY        =   19500
  125.       Begin VB.PictureBox Pic1 
  126.          Appearance      =   0  'Flat
  127.          AutoRedraw      =   -1  'True
  128.          BackColor       =   &H80000005&
  129.          BeginProperty Font 
  130.             Name            =   "Arial"
  131.             Size            =   6
  132.             Charset         =   0
  133.             Weight          =   400
  134.             Underline       =   0   'False
  135.             Italic          =   0   'False
  136.             Strikethrough   =   0   'False
  137.          EndProperty
  138.          ForeColor       =   &H80000008&
  139.          Height          =   11895
  140.          Left            =   0
  141.          ScaleHeight     =   791
  142.          ScaleMode       =   3  'Pixel
  143.          ScaleWidth      =   1120
  144.          TabIndex        =   21
  145.          Top             =   0
  146.          Width           =   16830
  147.       End
  148.    End
  149.    Begin VB.CommandButton Command3 
  150.       Caption         =   "Save year"
  151.       Height          =   375
  152.       Left            =   4560
  153.       TabIndex        =   19
  154.       Top             =   120
  155.       Width           =   1095
  156.    End
  157.    Begin VB.CommandButton Command2 
  158.       Caption         =   "Save this"
  159.       Height          =   375
  160.       Left            =   3360
  161.       TabIndex        =   18
  162.       Top             =   120
  163.       Width           =   1095
  164.    End
  165.    Begin VB.ComboBox Combo1 
  166.       Height          =   315
  167.       Left            =   1080
  168.       TabIndex        =   17
  169.       Text            =   "Combo1"
  170.       Top             =   120
  171.       Width           =   855
  172.    End
  173.    Begin VB.PictureBox picColors 
  174.       BackColor       =   &H000000FF&
  175.       Height          =   255
  176.       Index           =   15
  177.       Left            =   16560
  178.       ScaleHeight     =   195
  179.       ScaleWidth      =   195
  180.       TabIndex        =   16
  181.       Top             =   120
  182.       Width           =   255
  183.    End
  184.    Begin VB.PictureBox picColors 
  185.       BackColor       =   &H009504FF&
  186.       Height          =   255
  187.       Index           =   14
  188.       Left            =   16320
  189.       ScaleHeight     =   195
  190.       ScaleWidth      =   195
  191.       TabIndex        =   15
  192.       Top             =   120
  193.       Width           =   255
  194.    End
  195.    Begin VB.PictureBox picColors 
  196.       BackColor       =   &H00C004FF&
  197.       Height          =   255
  198.       Index           =   13
  199.       Left            =   16080
  200.       ScaleHeight     =   195
  201.       ScaleWidth      =   195
  202.       TabIndex        =   14
  203.       Top             =   120
  204.       Width           =   255
  205.    End
  206.    Begin VB.PictureBox picColors 
  207.       BackColor       =   &H00FF00FF&
  208.       Height          =   255
  209.       Index           =   12
  210.       Left            =   15840
  211.       ScaleHeight     =   195
  212.       ScaleWidth      =   195
  213.       TabIndex        =   13
  214.       Top             =   120
  215.       Width           =   255
  216.    End
  217.    Begin VB.PictureBox picColors 
  218.       BackColor       =   &H00FF04B4&
  219.       Height          =   255
  220.       Index           =   11
  221.       Left            =   15600
  222.       ScaleHeight     =   195
  223.       ScaleWidth      =   195
  224.       TabIndex        =   12
  225.       Top             =   120
  226.       Width           =   255
  227.    End
  228.    Begin VB.PictureBox picColors 
  229.       BackColor       =   &H00FF0000&
  230.       Height          =   255
  231.       Index           =   10
  232.       Left            =   15360
  233.       ScaleHeight     =   195
  234.       ScaleWidth      =   195
  235.       TabIndex        =   11
  236.       Top             =   120
  237.       Width           =   255
  238.    End
  239.    Begin VB.PictureBox picColors 
  240.       BackColor       =   &H00FF9B04&
  241.       Height          =   255
  242.       Index           =   9
  243.       Left            =   15120
  244.       ScaleHeight     =   195
  245.       ScaleWidth      =   195
  246.       TabIndex        =   10
  247.       Top             =   120
  248.       Width           =   255
  249.    End
  250.    Begin VB.PictureBox picColors 
  251.       BackColor       =   &H00FFFF00&
  252.       Height          =   255
  253.       Index           =   8
  254.       Left            =   14880
  255.       ScaleHeight     =   195
  256.       ScaleWidth      =   195
  257.       TabIndex        =   9
  258.       Top             =   120
  259.       Width           =   255
  260.    End
  261.    Begin VB.PictureBox picColors 
  262.       BackColor       =   &H0000FF00&
  263.       Height          =   255
  264.       Index           =   7
  265.       Left            =   14640
  266.       ScaleHeight     =   195
  267.       ScaleWidth      =   195
  268.       TabIndex        =   8
  269.       Top             =   120
  270.       Width           =   255
  271.    End
  272.    Begin VB.PictureBox picColors 
  273.       BackColor       =   &H0004FF8E&
  274.       Height          =   255
  275.       Index           =   6
  276.       Left            =   14400
  277.       ScaleHeight     =   195
  278.       ScaleWidth      =   195
  279.       TabIndex        =   7
  280.       Top             =   120
  281.       Width           =   255
  282.    End
  283.    Begin VB.PictureBox picColors 
  284.       BackColor       =   &H0004FFBA&
  285.       Height          =   255
  286.       Index           =   5
  287.       Left            =   14160
  288.       ScaleHeight     =   195
  289.       ScaleWidth      =   195
  290.       TabIndex        =   6
  291.       Top             =   120
  292.       Width           =   255
  293.    End
  294.    Begin VB.PictureBox picColors 
  295.       BackColor       =   &H0000FFFF&
  296.       Height          =   255
  297.       Index           =   4
  298.       Left            =   13920
  299.       ScaleHeight     =   195
  300.       ScaleWidth      =   195
  301.       TabIndex        =   5
  302.       Top             =   120
  303.       Width           =   255
  304.    End
  305.    Begin VB.PictureBox picColors 
  306.       BackColor       =   &H0004DAFF&
  307.       Height          =   255
  308.       Index           =   3
  309.       Left            =   13680
  310.       ScaleHeight     =   195
  311.       ScaleWidth      =   195
  312.       TabIndex        =   4
  313.       Top             =   120
  314.       Width           =   255
  315.    End
  316.    Begin VB.PictureBox picColors 
  317.       BackColor       =   &H0004A7FF&
  318.       Height          =   255
  319.       Index           =   2
  320.       Left            =   13440
  321.       ScaleHeight     =   195
  322.       ScaleWidth      =   195
  323.       TabIndex        =   3
  324.       Top             =   120
  325.       Width           =   255
  326.    End
  327.    Begin VB.PictureBox picColors 
  328.       BackColor       =   &H000482FF&
  329.       Height          =   255
  330.       Index           =   1
  331.       Left            =   13200
  332.       ScaleHeight     =   195
  333.       ScaleWidth      =   195
  334.       TabIndex        =   2
  335.       Top             =   120
  336.       Width           =   255
  337.    End
  338.    Begin VB.PictureBox picColors 
  339.       BackColor       =   &H000000FF&
  340.       Height          =   255
  341.       Index           =   0
  342.       Left            =   12960
  343.       ScaleHeight     =   195
  344.       ScaleWidth      =   195
  345.       TabIndex        =   1
  346.       Top             =   120
  347.       Width           =   255
  348.    End
  349.    Begin VB.CommandButton Command1 
  350.       Caption         =   "Draw"
  351.       Height          =   375
  352.       Left            =   120
  353.       TabIndex        =   0
  354.       Top             =   120
  355.       Width           =   855
  356.    End
  357. End
  358. Attribute VB_Name = "Form1"
  359. Attribute VB_GlobalNameSpace = False
  360. Attribute VB_Creatable = False
  361. Attribute VB_PredeclaredId = True
  362. Attribute VB_Exposed = False
  363. Option Explicit
  364.  
  365. Dim HasLoaded As Boolean
  366. Dim PI As Double
  367. Dim agDay As Double
  368. Dim xx As Long
  369. Dim yy As Long
  370. Dim lg As Long
  371. Dim trAg As Double
  372. Dim stLg As Double
  373. Dim xad As Long
  374. Dim ndYear As Long
  375. Dim ndMonth As Long
  376. Dim ndfMonth As Long
  377. Dim segP() As POINTAPI
  378. Dim lMoon() As POINTAPI
  379. Dim dMoon() As POINTAPI
  380. Dim gcol As Long
  381. Dim rd As Long, gd As Long, bd As Long
  382. Dim r2 As Long, g2 As Long, b2 As Long
  383. Dim r3 As Long, g3 As Long, b3 As Long
  384. Dim h As Double, h2 As Long, c As Long
  385. Dim lgPD As Long
  386. Dim cc As Long
  387. Dim cc2 As Long
  388. Dim WkN As Long
  389.  
  390. Private Type RGBset
  391.     Angle As Integer
  392.     R(0 To 15)
  393.     G(0 To 15)
  394.     b(0 To 15)
  395.     Count As Integer
  396. End Type
  397. Dim gradtemp As RGBset
  398.  
  399. Private Type POINTAPI
  400.         x As Long
  401.         y As Long
  402. End Type
  403.  
  404.  
  405. Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
  406. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  407. Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
  408. Private Declare Function PolyDraw Lib "gdi32" (ByVal hdc As Long, lppt As POINTAPI, lpbTypes As Byte, ByVal cCount As Long) As Long
  409. Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
  410. Private Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
  411. Private Declare Function PolylineTo Lib "gdi32" (ByVal hdc As Long, lppt As POINTAPI, ByVal cCount As Long) As Long
  412. Private Declare Function PolyPolygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, lpPolyCounts As Long, ByVal nCount As Long) As Long
  413. Dim AA2 As New LineGS
  414.  
  415. Private Type tAppoint
  416.     ID As Long
  417.     Hol_Date As Date
  418.     Comments As String
  419.     Task As Boolean
  420.     Status As Long
  421. End Type
  422.  
  423. Private hList() As tAppoint
  424.  
  425. Private Type LOGBRUSH
  426.         lbStyle As Long
  427.         lbColor As Long
  428.         lbHatch As Long
  429. End Type
  430. Private Declare Function CreateBrushIndirect Lib "gdi32" (lpLogBrush As LOGBRUSH) As Long
  431. Private Const BS_NULL = 1
  432. Private Const BS_HOLLOW = BS_NULL
  433.  
  434. Dim FontsAdded As Boolean
  435. Private cSun As clsSunrise
  436.  
  437. Private Sub DrawWkNo(tYear As Long, tMonth As Long)
  438. Dim cc As Long
  439. Dim cc2 As Long
  440. Dim wkC As Long
  441. Dim nWks As Long
  442. Dim wkP() As POINTAPI
  443. Dim tmpN As Long
  444. Dim MonSun As Single
  445. Dim tLine As Long
  446.  
  447. For cc = 1 To ndMonth
  448.     
  449.     If nWks = 0 Then
  450.         tmpN = 8 - Weekday(DateSerial(tYear, tMonth, cc), vbMonday)
  451.         If cc = 1 And tmpN < 7 Then tLine = 1
  452.         'Debug.Print Weekday(DateSerial(tYear, tMonth, cc), vbMonday)
  453.         If cc + tmpN - 1 > ndMonth Then
  454.             tLine = 2
  455.             tmpN = tmpN - (cc + tmpN - ndMonth) + 1
  456.         End If
  457.         tmpN = tmpN * 2 + 1
  458.         ReDim wkP(tmpN)
  459.         wkC = 0
  460.         
  461.     End If
  462.         
  463.         If Weekday(DateSerial(tYear, tMonth, cc), vbMonday) = 1 Then
  464.             MonSun = -0.5
  465.         ElseIf Weekday(DateSerial(tYear, tMonth, cc), vbMonday) = 7 Then
  466.             MonSun = -1.5
  467.         Else
  468.             MonSun = -1
  469.         End If
  470.         
  471.         trAg = ((cc + MonSun) * agDay) * PI / 180
  472.         wkP(tmpN - wkC).x = (lg * stLg + 10) * Cos(trAg) - xad
  473.         wkP(tmpN - wkC).y = (lg * stLg + 10) * Sin(trAg)
  474.         
  475.         trAg = ((cc + MonSun) * agDay) * PI / 180
  476.         wkP(wkC).x = (lg * stLg + 10 + WkN) * Cos(trAg) - xad
  477.         wkP(wkC).y = (lg * stLg + 10 + WkN) * Sin(trAg)
  478.                
  479.         wkC = wkC + 1
  480.         nWks = nWks + 1
  481.     
  482.     If Weekday(DateSerial(tYear, tMonth, cc), vbMonday) = 7 Or cc = ndMonth Then
  483.         
  484.         If Weekday(DateSerial(tYear, tMonth, cc), vbMonday) = 1 Then
  485.             MonSun = -1
  486.         'ElseIf Weekday(DateSerial(tYear, tMonth, cc), vbMonday) = 7 Then
  487.         '    MonSun = -1.5
  488.         'Else
  489.         '    MonSun = -1
  490.         End If
  491.         
  492.         trAg = ((cc + 1 + MonSun) * agDay) * PI / 180
  493.         wkP(tmpN - wkC).x = (lg * stLg + 10) * Cos(trAg) - xad
  494.         wkP(tmpN - wkC).y = (lg * stLg + 10) * Sin(trAg)
  495.         
  496.         trAg = ((cc + 1 + MonSun) * agDay) * PI / 180
  497.         wkP(wkC).x = (lg * stLg + 10 + WkN) * Cos(trAg) - xad
  498.         wkP(wkC).y = (lg * stLg + 10 + WkN) * Sin(trAg)
  499.         
  500.     'Pic1.ForeColor = RGB(250, 230, 210)
  501.     Pic1.ForeColor = RGB(250, 230, 210)
  502.     Pic1.FillColor = RGB(250, 230, 210)
  503.     Pic1.DrawWidth = 1
  504.     Pic1.DrawStyle = vbTransparent
  505.     Call Polygon(Pic1.hdc, wkP(0), tmpN + 1)
  506.     Pic1.DrawStyle = vbSolid
  507.     
  508.     For cc2 = 0 To tmpN - 1
  509.         If cc2 = (tmpN - 1) / 2 And tLine = 2 Then
  510.         Else
  511.         AA2.LineGP Pic1.hdc, wkP(cc2).x, wkP(cc2).y, wkP(cc2 + 1).x, wkP(cc2 + 1).y, 0
  512.         End If
  513.     Next
  514.     If tLine <> 1 Then AA2.LineGP Pic1.hdc, wkP(0).x, wkP(0).y, wkP(tmpN).x, wkP(tmpN).y, 0
  515.     tLine = 0
  516.     'Pic1.DrawWidth = 1
  517.     
  518. '    If Weekday(DateSerial(tYear, tMonth, cc + 1), vbMonday) = 4 Then
  519. '        trAg = ((cc + 0.7) * agDay) * PI / 180
  520. '        xx = (lg * stLg + 13 + WkN / 2) * Cos(trAg) - xad
  521. '        yy = (lg * stLg + 13 + WkN / 2) * Sin(trAg)
  522. '        'Print wk no
  523. '        Pic1.Font = Combo4
  524. '        Pic1.ForeColor = 0
  525. '        Call cFont(Pic1.hdc, Format(DateSerial(tYear, tMonth, cc + 1), "ww", vbMonday, vbFirstJan1), xx, yy - 7, 12, -90 + (ndfMonth * agDay), True)
  526. '    End If
  527.     nWks = 0
  528.     wkC = 0
  529.     Do
  530.     'Debug.Print wkC, wkP(wkC).x, wkP(wkC).y, UBound(wkP), tmpN
  531.     wkC = wkC + 1
  532.     Loop Until wkC = UBound(wkP) + 1
  533.     wkC = 0
  534.     'ReDim wkP(0)
  535.     End If
  536. Next
  537.  
  538. Pic1.Font = Combo4
  539. Pic1.ForeColor = 0
  540. For cc = 1 To ndMonth
  541.     If Weekday(DateSerial(tYear, tMonth, cc), vbMonday) = 4 Then
  542.         trAg = ((cc + 0.7 - 1) * agDay) * PI / 180
  543.         xx = (lg * stLg + 13 + WkN / 2) * Cos(trAg) - xad
  544.         yy = (lg * stLg + 13 + WkN / 2) * Sin(trAg)
  545.         'Print wk no
  546.         Call cFont(Pic1.hdc, Format(DateSerial(tYear, tMonth, cc), "ww", vbMonday, vbFirstJan1), xx, yy - 7, 12, -90 + (ndfMonth * agDay), True)
  547.     End If
  548. Next
  549. End Sub
  550.  
  551. Function MoonPhase(dInDate As Date) As Integer
  552.   Dim lD As Long
  553.   Dim dd As Double
  554.  
  555.   lD = DateDiff("d", "January 1, 2001", dInDate)
  556.   dd = 0.20439731 + lD * 0.03386319269
  557.   lD = Int(dd)
  558.   dd = dd - lD
  559.   lD = 360 * dd
  560.   If lD < 0 Then lD = lD + 360
  561.   lD = lD \ 2
  562.   'lD = lD * 2
  563.   'Debug.Print lD
  564.   'If lD > 179 Then lD = 179 - lD
  565.   MoonPhase = lD * 2
  566.   
  567.   'Debug.Print 179 - (179 - MoonPhase), MoonPhase
  568.   If MoonPhase > 179 Then MoonPhase = 179 + (179 - MoonPhase)
  569. '  Debug.Print MoonPhase
  570.   'MoonPhase = lD
  571.   
  572. End Function
  573.  
  574. Sub FindInfo(TheDate As Date, NumDays As Long)
  575.     'Dim s$, p&, X&, Y As Long, xOff&, yOff&, n&, h&
  576.     Dim tYear As Long
  577.     'Dim NumDays As Long
  578.     Dim tmpDate As Date
  579.     Dim tmpDate2 As Date
  580.     Dim tmpString As String
  581.     Dim TmpEnd As Date
  582.     Dim TmpInter As Long
  583.     Dim TmpNum As String
  584.     Dim oitemTmp As String
  585.     Dim hcc As Long
  586.     
  587.     hcc = 0
  588.     Erase hList
  589.     ReDim hList(hcc)
  590.         
  591.     'CanDraw = False
  592.     'NumDays = 60
  593.           
  594.     Dim oApp As Outlor2 AsFals= Format(ormat(ormat(ormat(ormat(ormat( AsFals= Format(ormat(ormat(ormat(ormat(ormat( AsFals= Format(ormat(ormat(ormat(ormat(ormat( AsFals= Format(ormat(ormat(ormat(ormat(ormat( AsFals= Format(ormat(ormat(ormat(ormat(ormat
  595.   Dim lD As Longormat
  596.   Dim lD Adc,ThenRSUkC 4mat(ormat(o FormattttttttttttttttmDaysmDayDim lD Adc,ThenRSUkC 4mat(ormat(o Formatttttttttong
  597. Dim AA2 As New LineGS
  598.  
  599. Private Type tAppoint
  600.     ID As Long
  601.     Hol_Date As mate Type tAppoint8wtA" (lpLogFong
  602.     Hol_Date Asa"cs    Ne,ligmls= Fo